const requestLocal = require('../app/util/requestLocal')
const indexList = require('../app/common/indexList')
let list = indexList.list

let index = 0
let timer = setInterval(() => {
  if (index < list.length) {
    requestLocal.get('stock/initStockPrice', {
      code: list[index].code,
      count: 300
    }).then(() => {
      console.log(index)
      console.log('ok')
      index++
    }).catch(() => {
      clearInterval(timer)
    })
  } else {
    clearInterval(timer)
  }
}, 1000 * 10)
